package homework03;

public class BankAccount {
    private Double balance;

    public BankAccount() {
        this.balance = 0.0;
    }

    public void deposit(Double amount){
        if (amount < 0) {
            System.out.println("存款金额不能为负数");
            return;
        }
        balance += amount;
        System.out.println("存款成功,当前余额为:" + balance);
    }


    public Double getBalance() {
        return balance;
    }


    public void Withdrawal(Double amount){
        if (amount < 0) {
            System.out.println("取款金额不能为负数");
            return;
        }
        if (amount > balance) {
            System.out.println("余额不足,取款失败!");
            return;
        }
        balance -= amount;
        System.out.println("取款成功,当前余额为:" + balance);
    }
}
